package io.geekidea.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.geekidea.springboot.entity.Building;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface BuildingMapper extends BaseMapper<Building> {

    Building selectBuildingWithId(@Param("id") Long id);

    List<Building> selectBuildingsWithType(@Param("types") List<Long> types);

    Page<Building> selectBuildingsWithType(IPage<Building> page, @Param("types") List<Long> types);


    List<Building> selectExportBuildings(@Param("types") List<Long> types,@Param("ids") List<Long> ids);

    @Select("SELECT COUNT(*) FROM SYSDBA.BUILDING WHERE TYPE = #{typeId}")
    int countByTypeId(@Param("typeId") Long typeId);

}
